<?php
namespace app\common\validate;

use think\Validate;

class Admin extends Validate {

    protected $rule = [
        'username'=>'require|min:3|max:20',
        'nickname'=>'require|max:20',
        'password'=>'require|min:6|max:20',
    ];

    protected $message = [
        'username.require'=>'请输入账户',
        'username.min'=>'账号最少3个字符',
        'username.max'=>'账号最多20个字符',
        'nickname.require'=>'请输入昵称',
        'nickname.min'=>'昵称最多20个字符',
        'password.require'=>'请输入密码',
        'password.min'=>'密码最低6个字符',
        'password.max'=>'密码最多20个字符'
    ];

    protected $scene = [
        'add'=>[
            'username','nickname','password'
        ],
        'edit'=>[
            'username','nickname'
        ]
    ];
}